package com.stox.navigator.ui.swing.view;

import java.awt.BorderLayout;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import com.stox.core.ui.swing.wrapper.JPanel;
import com.stox.navigator.ui.swing.widget.JTreeSearchPanel;

public abstract class AbstractNavigatorTab extends JPanel implements NavigatorTab, KeyListener {
	private static final long serialVersionUID = -8376273778431027138L;

	private boolean initialized = false;
	
	public AbstractNavigatorTab() {
		add(new JTreeSearchPanel(this, this), BorderLayout.SOUTH);
	}

	@Override
	public void keyPressed(KeyEvent e) {}

	@Override
	public void keyReleased(KeyEvent e) {}

	@Override
	public boolean isInitialized() {
		return initialized;
	}
	
	@Override
	public void initialize() {
		synchronized(this){
			if(!initialized){
				initializeInternal();
				//revalidate();
			}
			initialized = true;
		}
	}
	
	protected abstract void initializeInternal();

}
